#!/usr/bin/env python3
# -*- coding:utf-8 -*-

# 绘制18*18 棋盘

import turtle


def test_1(num=19):
    width = 30
    x1 = [(-400, 400), (-400 + width * num, 400)]
    y1 = [(-400, 400), (-400, 400 - width * num)]
    printer = turtle.Pen()
    printer.speed(10)
    # printer.goto(x1[0][0],x1[0][1])
    # printer.goto(x1[1][0],x1[1][1])
    for i in range(0, num + 1):
        printer.penup()
        printer.goto(x1[0][0], x1[0][1] - 30 * i)
        printer.pendown()
        printer.goto(x1[1][0], x1[1][1] - 30 * i)

    for i in range(0, num + 1):
        printer.penup()
        printer.goto(y1[0][0] + 30 * i, y1[0][1])
        printer.pendown()
        printer.goto(y1[1][0] + 30 * i, y1[1][1])

    printer.hideturtle()  # 隐藏画笔
    turtle.done()  # 保证运行窗口不被自动关闭


def main():
    test_1()



if __name__ == "__main__":
    main()
